/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entidades.EntidadesAdministracion;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;

/**
 *
 * @author daniel
 */
@Entity
@Table(name = "rolespersona")
@NamedQueries({
    @NamedQuery(name = "Rolespersona.findAll", query = "SELECT r FROM Rolespersona r"),
    @NamedQuery(name = "Rolespersona.findByIdRolesPersona", query = "SELECT r FROM Rolespersona r WHERE r.idRolesPersona = :idRolesPersona")})
public class Rolespersona implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "IdRolesPersona")
    private Integer idRolesPersona;
    @JoinColumn(name = "IdPersona", referencedColumnName = "IdPersona")
    @ManyToOne(optional = false)
    private Persona persona;
    @JoinColumn(name = "IdRoles", referencedColumnName = "IdRoles")
    @ManyToOne(optional = false)
    private Roles roles;

    public Rolespersona() {
    }

    public Rolespersona(Integer idRolesPersona) {
        this.idRolesPersona = idRolesPersona;
    }

    public Integer getIdRolesPersona() {
        return idRolesPersona;
    }

    public void setIdRolesPersona(Integer idRolesPersona) {
        this.idRolesPersona = idRolesPersona;
    }

    public Persona getPersona() {
        return persona;
    }

    public void setPersona(Persona persona) {
        this.persona = persona;
    }

    public Roles getRoles() {
        return roles;
    }

    public void setRoles(Roles roles) {
        this.roles = roles;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idRolesPersona != null ? idRolesPersona.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Rolespersona)) {
            return false;
        }
        Rolespersona other = (Rolespersona) object;
        if ((this.idRolesPersona == null && other.idRolesPersona != null) || (this.idRolesPersona != null && !this.idRolesPersona.equals(other.idRolesPersona))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.EntidadesAdministracion.Rolespersona[ idRolesPersona=" + idRolesPersona + " ]";
    }
    
}
